package com.zjitc.p1;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/13 16:48
 * @description:
 */
@Aspect
public class SectionPoint {
  @Pointcut("execution(* com.zjitc.p1.A.a())")
 public void piontcutA(){}
 @Pointcut("execution(* com.zjitc.p1.A.b())")
 public void piontcutB(){}

 @Before("piontcutA()")
  public void beforeA(){
   System.out.println("into before a");
 }

 @After("piontcutA()")
 public void afterA(){
   System.out.println(" destroy after a");
 }

 @AfterThrowing("piontcutB()")
  public void throwA(){
   System.out.println("exception error");
 }

@Around("execution(* com.zjitc.p1.A.c())")
public void around(ProceedingJoinPoint jp) throws Throwable {
  System.out.println(jp.getSignature().getName());
  jp.proceed();
}

}
